package com.whmnx.my.ui.adapter;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.classic.adapter.BaseAdapterHelper;
import com.classic.adapter.CommonRecyclerAdapter;
import com.whmnx.base.bean.OrderDetailBean;
import com.whmnx.base.utils.ImageUtil;
import com.whmnx.my.R;
import com.whmnx.my.ui.activity.AppraiseActivity;

/**
 * author : huang
 * date   : 2020/10/19 0019 9:17
 * version: 1.0
 * @author Administrator
 */
public class AppreaiseListAdapter extends CommonRecyclerAdapter<OrderDetailBean.ProductListBean> {
    Context context;
    public AppreaiseListAdapter(Context context) {
        super(context, R.layout.grid_order5);
        this.context = context;
    }


    @Override
    public void onUpdate(BaseAdapterHelper helper, OrderDetailBean.ProductListBean item, int position) {
        helper.setText(R.id.tv_goods_desc, (String) item.getProduct_Name());
        helper.setText(R.id.tv_desc, (String) item.getProduct_SPEC());
        helper.setText(R.id.tv_moeny, "￥" + item.getProduct_Price() + "");
        helper.setText(R.id.tv_goods_num, "x" + item.getProduct_Num() + "");
        ImageUtil.setImage(helper.getView(R.id.iv_goods), item.getProduct_Image());

        helper.setOnClickListener(R.id.tv_btn_2, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Bundle bundle = new Bundle();
                context.startActivity(new Intent(context,AppraiseActivity.class).putExtra("Product_Id",item.getProduct_Id()));
            }
        });
    }
}
